package mh.entity.spell;

import mh.entity.Damage;
import mh.entity.Entity;
import mh.entity.player.EntityPlayer;
import mh.map.render.RenderSpell;

public class EntitySpell extends Entity {

	private Damage			damage;
	private EnumSpells		spell;
	private EntityPlayer	sender;

	private double			velocity	= 0;
	private double			xSpeed		= 0;
	private double			ySpeed		= 0;
	private double			rotation	= 0;

	protected EntitySpell(EnumSpells spell, EntityPlayer sender, int maximumHealth, int mouseX, int mouseY) {
		super(false, 0, maximumHealth, false, 0);
		this.render = new RenderSpell(this, null);
		this.HBVisible = false;

		this.spell = spell;
		this.sender = sender;

		//TODO calculate velocity of the spell, related to player strenght
		double cosAlpha;
		double sinAlpha;
		mouseX -= TILE_SIZE_DBL / 2;
		mouseY -= TILE_SIZE_DBL / 2;
		double distance = Math.sqrt(Math.pow(mouseY - CENTRAL_ROW_PX, 2) + Math.pow(mouseY - CENTRAL_COLUMN_PX, 2));
		sinAlpha = (mouseX - CENTRAL_COLUMN_PX) / distance;
		cosAlpha = (mouseY - CENTRAL_ROW_PX) / distance;
		this.xSpeed = this.velocity * sinAlpha;
		this.ySpeed = this.velocity * cosAlpha;
		this.rotation = Math.toDegrees(Math.atan2(mouseY - CENTRAL_ROW_PX, mouseY - CENTRAL_COLUMN_PX));
	}

	@Override
	public boolean collide(Entity with) {
		return false;
	}

	/**
	 * @return The <code>Damage</code> inflicted by this spell
	 */
	public Damage getDamage() {
		return this.damage;
	}

	@Override
	public boolean isWalkable() {
		// TODO Auto-generated method stub
		return true;
	}

	/**
	 * A spell should never show an health bar.
	 * 
	 * @param vis
	 *            UNUSEFUL
	 */
	@Override
	public void setHealthBarVisibility(boolean vis) {
		return;
	}

	@Override
	public void draw(long delta, boolean foreground) {
		// TODO Auto-generated method stub

	}

}
